/*
@author: user
@date: 2022/6/17 17:46
@Version: 1.0
@last modifined by : 2022/6/17 17:46
@last Modifined time : 2022/6/17 17:46
*/

import React from 'react';
import { globalCalcWidth } from '@G/default';
import { connect } from 'react-redux';
import { getAntdIcon } from '@U/tool';
import './index.less';

/** CopyrightStatement(版权声明)组件说明
* @author: JasonStandFor
* @description Desc:: 底部版权声明
* @expandState:: {Boolean} 参数取自于左侧菜单栏的展开状态，根据展开状态调整布局位置
* @isForceCenter:: {Boolean} 强制居中
* @return CopyrightStatement
* @example:
 example 1:
 <CopyrightStatement />
 example 2:
 <CopyrightStatement isForceCenter />
* */
const Index = ({ expandState, isForceCenter }) => {
  const { expandState: { expand, shrink} } = globalCalcWidth;

  return (
    <div className="common-component-copyright-statement">
      <div
        className="common-component-copyright-statement-wrap"
        style={{ width: (isForceCenter && '100%') || (expandState ? expand : shrink) }}
      >
        {/* <img src="http://cn.redux.js.org/img/redux.svg" alt="图片加载失败。。。"/> */}
        { getAntdIcon('AntDesignOutlined') }
        <p>
          Copyright © {`${new Date().getFullYear() - 5} ~ ${new Date().getFullYear()}`} Jason·Stan·For And &#39;小阿峰&#39;.
        </p>
      </div>
    </div>
  );
};

export default connect((state) => ({
  expandState: state.theme.collapsed,
}))(Index);
